package org.example.mq.controller;

import org.example.core.utils.R;
import org.example.mq.entity.MqMessageEntity;
import org.example.mq.service.MqMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 小杰_cc
 * @version 1.0
 */
@RestController
@RequestMapping("/mq/backend")
public class MqMessageController {

    @Autowired
    private MqMessageService mqMessageService;

    /**
     * 添加发送失败的消息
     * @return
     */
    @PostMapping("/add")
    public R<?> add(@RequestBody MqMessageEntity message){
        return mqMessageService.addMqMessage(message)>0? R.ok():R.error();
    }
}
